<template>
  <div>
    <div class="top">
      <span class="fu" @click="fun()">&lt;</span>
      <span class="i">我的信息</span>
      <ul>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>
    <img src="@/assets/ayuan/images/c1_03.gif" alt="" />
    <div class="two">
      <span>姓名</span>
      <input type="text" v-model="username" />
    </div>
    <div class="two">
      <span>邮箱</span>
      <input type="text" v-model="userEmail" />
    </div>
    <div class="two">
      <span>身份证号</span>
      <input type="text" v-model="userId" ref="ids"/>
    </div>
    <div class="two">
      <span>地址</span>
      <input type="text" v-model="userAddress" />
    </div>
    <button @click="shen()">点我提交认证</button>
  </div>
</template>

<script>
import { wan_shan } from "@/apis/mycom.js";
export default {
  data() {
    return {
      username: "",
      userEmail: "",
      userId: "",
      userAddress: "",
    };
  },

  //   directives: {
  //     //定义自定义指令
  //     ayuan: {
  //       inserted(el) {
  //         el.focus();
  //       },
  //     },
  //   },

  methods: {
    fun() {
      this.$router.go(-1);
    },
    // heiha1(){
    //   if(this.username.trim() !=''){
    //     wan_shan({username:this.username},{}).then((ok)=>{
    //       console.log(ok)
    //       if(ok.data.code==0){
    //         this.$toast.fail('用户名已被注册！')
    //         this.username='';
    //       }
    //     })
    //   } else {
    //     this.$toast.fail("用户名不能为空！")
    //   }
    // },
    // heiha() {
    //   if (this.username && this.userEmail && this.userId && this.userAddress) {
    //     wan_shan({
    //       username: this.username,
    //       userEmail: this.userEmail,
    //       userId: this.userId,
    //       userAddress: this.userAddress,
    //     }).then((ok) => {
    //       if (ok.data.code == 200) {
    //         console.log(ok.data);
    //       }
    //     });
    //   } else {
    //     this.$toast.fail("请输入正确的信息");
    //   }
    // },
    // heiha2(){
    //   if(this.userEmail){
    //     wan_shan({})
    //   }
    // },
    shen() {
      
      wan_shan({
        username: this.username,
        userEmail: this.userEmail,
        userId: this.userId,
        userAddress: this.userAddress,
      }).then((ok) => {
        console.log(ok.data);

        if (ok.data.code == 1) {  
          console.log(this.$refs.ids.value);
          this.$router.push({name:"applyfor",query:{myid:this.$refs.ids.value}})
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.top {
  background-color: #2d6cb9;
  color: white;
  display: flex;
  height: 0.6rem;
  .i {
    display: block;
    margin-left: 1.04rem;
    line-height: 0.6rem;
    font-size: 0.2rem;
  }
  .fu {
    font-size: 0.36rem;
    margin-left: 0.16rem;
    line-height: 0.6rem;
  }
  ul {
    // float:right;
    // line-height: .6rem;
    position: absolute;
    right: 0.1rem;
    top: 0.26rem;
  }
  li {
    width: 0.08rem;
    height: 0.08rem;
    border-radius: 50%;
    float: left;
    background-color: white;
    margin-right: 0.06rem;
    list-style: none;
  }
}
img {
  width: 1rem;
  position: absolute;
  top: 0.7rem;
  right: 0.16rem;
}
.two {
  display: flex;
  width: 3rem;
  margin-left: 0.2rem;
  border-bottom: 0.02rem solid rgba(128, 128, 128, 0.14);
  padding-right: 0.16rem;
  span {
    display: block;
    width: 0.8rem;
    height: 0.54rem;
    line-height: 0.54rem;
    font-size: 0.18rem;
    font-weight: 700;
  }
  input {
    border: none;
    height: 0.48rem;
  }
}
button {
  width: 1.1rem;
  height: 0.42rem;
  // margin: auto;
  margin-top: 0.16rem;
  margin-left: 1.3rem;
}
</style>